﻿@model ZJK.Models.ExpertManage.vmBakForExtract
@{
    ViewBag.Title = "抽取设置";
    Layout = "~/Views/Shared/ExpertManage/_Layout_ExpertManage.cshtml";
}

<h2>抽取设置</h2>
@Styles.Render("~/Scripts/ztree/zTreeStyle.css")
@Scripts.Render("~/Scripts/ztree/jquery.ztree.all-3.5.min.js")
<script type="text/javascript" src="@Url.Content("~/Scripts/jQuery.tmpl.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/Expert/ExtractBak.js")"></script>
<script type="text/javascript">
    //树形分类的配置项目
    var setting = {
        view: {
            selectedMulti: false
        },
        check: {
            chkboxType: { "Y": "ps", "N": "ps" },
            enable: true
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            //onClick: onClick
        }
    };

    //当前抽取备选记录的项目设置地址，用于获取和设置当前抽取记录关联的项目列表
    var strUrlgetThisRecordProjectLists = '@Url.Content("~/ExpertManage/BakForExtract_getProjectLists")';
    var strUrlsetThisRecordProjectLists = '@Url.Content("~/ExpertManage/BakForExtract_saveProjectLists")';

    //获取当前抽取备选记录详细记录的链接地址，用于获取当前抽取记录的详细记录
    var strUrlgetThisRecordDetails = '@Url.Content("~/ExpertManage/BakForExtract_getDetails")';
    //为当前抽取备选记录添加详细记录的链接地址，用于为当前抽取备选记录添加一条指定专家详细记录
    var strUrladdThisRecordDetail = '@Url.Content("~/ExpertManage/BakForExtract_AddDetail")';
    //删除指定详细记录ID的链接地址，用于删除当前指定ID的专家详细记录
    var strUrldeleteThisDetail = '@Url.Content("~/ExpertManage/BakForExtract_DeleteDetail")';
    //获取指定ID的详细记录的链接地址，用于获取详细记录信息，弹出编辑对话框
    var strUrlgetThisDetail = '@Url.Content("~/ExpertManage/BakForExtract_getDetail")';
    //保存指定ID的详细记录的链接地址，用于保存详细记录信息，关闭编辑对话框
    var strUrlsaveThisDetail = '@Url.Content("~/ExpertManage/BakForExtract_SaveDetail")';

    //获取分类信息的地址
    var strUrlgetCategorys = '@Url.Content("~/Category/getCategorys")';

    //根据ID获取专家信息的地址
    var strUrlgetAExpert = '@Url.Content("~/ExpertManage/getAExpert")';

    //根据查询条件，获取专家信息列表的地址
    var strUrlgetExpertBXs = '@Url.Content("~/ExpertManage/getExperts")';

    $(document).ready(function () {
        //根据备选记录ID，获取本次项目列表
        getProjectListForThisBakRecord(strUrlgetThisRecordProjectLists, $("#bakID").val());

        //根据备选记录ID，获取此记录的详细记录列表
        getDetailsForThisBakRecord(strUrlgetThisRecordDetails, $("#bakID").val());

        //初始化专家分类树形
        getCategorys(strUrlgetCategorys);

        $("#FORM_EditDetail").dialog({
            autoOpen: false,
            height: 530,
            width: 600,
            resizable: false,
            modal: true,
            draggable: true,
            title: "备选专家信息暂时修改",
            buttons: {
                "保存当前修改": function () {
                    //保存当前详细记录
                    saveThisDetail();
                },
                "取消": function () { $(this).dialog("close"); }
            }
        });
    });
</script>


<div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
    @using (Html.BeginForm("Confirm", "ExpertManage", FormMethod.Post, new { id = "form_op" }))
    {
        @Html.HiddenFor(m => m.bak_record_id, new { @id = "bakID" })
        @Html.HiddenFor(m => m.bak_record_proj_ids, new { @id = "projIDs" })
        @Html.HiddenFor(m => m.bak_record_user_name, new { @id = "opUserName" })
        @Html.HiddenFor(m => m.bak_record_date, new { @id = "opDatetime" })
        
        <div style="position: relative; width: 25%; float: left;">
            <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                <b>所关联的项目：</b>
            </div>
        </div>
        <div style="width: 25%; float: right; padding: 0.7em;">
            修改关联项目后，点击【<b><a href="javascript:setProjectListForThisBakRecord(strUrlsetThisRecordProjectLists)">这里</a></b>】保存关联项目
        </div>
        <div style="position: relative; margin-left: 25%; margin-right: 25%; overflow: hidden;">
            <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                <!-- 项目列表的模板 -->
                <script id="DataTemplate_ProjectList" type="text/html">
                    <li style="padding: .5em;">{{if proj_is_selected>0}}
                        <input name="cbProject" type="checkbox" value="{{= proj_id}}" id="checked{{= proj_id}}" checked="checked" />
                        <label for="checked{{= proj_id}}">[{{= proj_code}}]{{= proj_name }}</label>
                        {{else}}
                        <input name="cbProject" type="checkbox" value="{{= proj_id}}" id="check{{= proj_id}}" />
                        <label for="check{{= proj_id}}">[{{= proj_code}}]{{= proj_name }}</label>
                        {{/if}}
                    </li>
                </script>
                <ul style="list-style-type: none; margin: 0; padding: 0;" id="bak_projectList">
                </ul>
            </div>
        </div>
        <div class="splid">
        </div>
        <div style="position: relative; width: 25%; float: left;">
            <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                <b>查询条件：</b>
            </div>
        </div>
        <div style="width: 25%; float: right; padding: 0.7em;">
        </div>
        <div style="position: relative; margin-left: 25%; margin-right: 25%; overflow: hidden;">
            <div class="ui-widget-header ui-corner-all" style="padding: 0.7em;">
                备选专家列表
            </div>
        </div>
        <div class="splid">
        </div>
        <div style="position: relative; width: 25%; float: left;">
            <div class="ui-widget-content ui-corner-all" style="position: relative; padding: 0.7em;">
                <div style="margin: 3px;">
                    专家姓名：<br />
                    <input type="text" value="" id="qName" style="width: 10em;" />
                </div>
                <div style="margin: 3px;">
                    专家专业（输入后提示）：<br />
                    <input type="text" value="" id="qProfessional" style="width: 10em;" />
                </div>
                <div style="margin: 3px;">
                    专家分类：<br />
                    <div style="height: 140px; overflow: scroll; background-color: #EEE;">
                        <ul id="treeCategory" class="ztree">
                        </ul>
                    </div>
                </div>
                <div style="margin: 3px;">
                    <span class="btn" title="按条件查询专家列表" onclick="javascript:getExpertBXs(strUrlgetExpertBXs);">查询专家列表</span>
                </div>
            </div>
        </div>
        <div style="width: 25%; float: right; padding: 0.7em;">
            点击专家信息，选定。
        </div>
        <div style="position: relative; margin-left: 25%; margin-right: 25%; overflow: hidden;">
            <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                <!-- 备选专家列表的模板 -->
                <script id="DataTemplate_ExpertBX" type="text/html">
                    <li style="padding: 0.5em;">▪&nbsp;<a href="javascript:saveExpertAsDetail(strUrladdThisRecordDetail, '{{= ID }}');">{{= Name }}&nbsp;
                            [{{= Company }}、{{= Title }}、{{= Mobile }}];</a>
                        <span style="color: Gray;">{{= Professional }}</span><br />
                        <span style="color: Red;">{{= Describe }}</span>
                    </li>
                </script>
                <ul style="list-style-type: none; margin: 0px; padding: 0px;" id="ExpertBXs">
                </ul>
                <p id="expertBXsInfo">
                </p>
            </div>
        </div>
        <div class="splid">
        </div>
        <div style="position: relative; width: 25%; float: left;">
            <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                <b>已选专家列表</b>
            </div>
            <span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
            点击已经备选的专家记录，进行修改操作
        </div>
        <div style="position: relative; margin-left: 25%; overflow: hidden;">
            <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                <!-- 已选专家列表的模板 -->
                <script id="DataTemplate_Details" type="text/html">
                    <li style="">
                        <div>
                            <div class="ui-widget-header ui-corner-all">
                                <span style="font-size: 2em; font-weight: bold;">{{= expName }}</span>&nbsp;
                                <span>[{{= expCompany }}、{{= expTitle }}、{{= expMobile }}]</span>
                                <span style="color: Gray;">{{= expProfessional }}</span>
                            </div>
                            <div>
                                {{if is_selected == 1 }}
                                <span class="ui-icon ui-icon-circle-check" style="float: left; margin-right: .3em;"></span>
                                <span style="color: blue">该专家参加评标</span>{{/if}} 
                                {{if is_selected == 0}}
                                <span class="ui-icon ui-icon-circle-close" style="float: left; margin-right: .3em;"></span>
                                <span style="color: red">该专家不参加评标</span>{{/if}} 
                                {{if is_selected == -1}}
                                <span class="ui-icon ui-icon-circle-minus" style="float: left; margin-right: .3em;"></span>
                                <span style="color: #AAA;">该专家仅出现在备选中，不会被选中</span>{{/if}} 
                                &nbsp;&nbsp;&nbsp;&nbsp;[<a href="javascript:deleteADetail(strUrldeleteThisDetail, '{{= Id}}');">删除</a>]
                                &nbsp;&nbsp;[<a href="javascript:showFormToEditADetail('{{= Id}}');">修改</a>]
                            </div>
                            <div>
                                <div>
                                    <strong>抽取过程提示：</strong><span style="color: Gray;">如果抽取不成功，请修改抽取不成功信息。</span><br />
                                    <p>{{= un_selected_msg}}</p>
                                </div>
                            </div>
                            <div style="height: 20px;">
                            </div>
                        </div>
                    </li>
                </script>
                <ul style="list-style-type: none; margin: 0px; padding: 0px;" id="ExtractDetails">
                </ul>
            </div>
        </div>
        <div class="splid">
        </div>
        <!-- 以下为备选详细记录修改的弹出窗 -->
        <div id="FORM_EditDetail">
            <input type="hidden" id="frmEdit_detailId" />
            <input type="hidden" id="frmEdit_expId" />
            <div style="position: relative; width: 25%; float: left;">
                <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                    <b>专家姓名：</b>
                </div>
            </div>
            <div style="position: relative; margin-left: 25%; overflow: hidden;">
                <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                    <label id="frmEdit_expName" style="font-size:1.2em; font-weight:bold;"></label>
                </div>
            </div>
            <div class="splid">
            </div>
            <div style="position: relative; width: 25%; float: left;">
                <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                    <b>内定抽取结果：</b>
                </div>
            </div>
            <div style="position: relative; margin-left: 25%; overflow: hidden;">
                <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                    <input type="radio" id="frmEdit_is_selected_1" name="frmEdit_is_selected" value="-1" /><label for="frmEdit_is_selected_1" style="color:#444;">仅为备选；</label>
                    <input type="radio" id="frmEdit_is_selected_2" name="frmEdit_is_selected" value="0" checked="checked" /><label for="frmEdit_is_selected_2" style="color:red;">内定为不参加；</label>
                    <input type="radio" id="frmEdit_is_selected_3" name="frmEdit_is_selected" value="1" /><label for="frmEdit_is_selected_3" style="color:blue;">内定为参加；</label><br />
                    <span style="color:#aaa;">选择仅为备选，则当前专家尽出现在备选专家列表中，不会被抽取选中；</span>
                </div>
            </div>
            <div class="splid">
            </div>
            <div style="position: relative; width: 25%; float: left;">
                <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                    <b>抽取显示信息：</b>
                </div>
            </div>
            <div style="position: relative; margin-left: 25%; overflow: hidden;">
                <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                    <textarea id="frmEdit_un_selected_msg"></textarea>
                </div>
            </div>
            <div class="splid">
            </div>
            <div style="position: relative; width: 25%; float: left;">
                <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                    <b>工作单位：</b>
                </div>
            </div>
            <div style="position: relative; margin-left: 25%; overflow: hidden;">
                <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                    <label id="frmEdit_expCompany"></label>
                </div>
            </div>
            <div class="splid">
            </div>
            <div style="position: relative; width: 25%; float: left;">
                <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                    <b>手机：</b>
                </div>
            </div>
            <div style="position: relative; margin-left: 25%; overflow: hidden;">
                <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                    <input id="frmEdit_expMobile" type="text" />
                </div>
            </div>
            <div class="splid">
            </div>
            <div style="position: relative; width: 25%; float: left;">
                <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                    <b>专业：</b>
                </div>
            </div>
            <div style="position: relative; margin-left: 25%; overflow: hidden;">
                <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                    <input id="frmEdit_expProfession" type="text" />
                </div>
            </div>
            <div class="splid">
            </div>

            
            <div style="position: relative; width: 25%; float: left;">
                <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                    <b>专家分类：</b>
                </div>
            </div>
            <div style="position: relative; margin-left: 25%; overflow: hidden;">
                <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                    <ul id="frmEdit_expCategory" class="ztree"></ul>
                </div>
            </div>
            <div class="splid">
            </div>
        </div>
    }
</div>
